﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Profile;

namespace WebSite.cn
{
    public partial class pinpai : System.Web.UI.UserControl
    {
        // Fields
        public string isshow = "";
        public string pinmsg = "";

        // Methods
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                DataTable table;
                if (base.Request.QueryString["pinid"] != null)
                {
                    if (base.Request.QueryString["typeid"] != null)
                    {
                        this.pinmsg = this.pinmsg + "<li><a href='products_category.aspx?typeid=" + base.Request.QueryString["typeid"] + "'>\x00ab 返回所有品牌 </a></li>";
                    }
                    else
                    {
                        this.pinmsg = this.pinmsg + "<li><a href='products_category.aspx'>\x00ab 返回所有品牌 </a></li>";
                    }
                    table = SQLAccess.GreatDs("select pinpainame from DB_Pinpai where pinpaiid=" + base.Request.QueryString["pinid"] + "").Tables[0];
                    if (table.Rows.Count > 0)
                    {
                        this.pinmsg = this.pinmsg + "<li>" + table.Rows[0]["pinpainame"].ToString() + "</li>";
                    }
                }
                else if (base.Request.QueryString["typeid"] != null)
                {
                    table = SQLAccess.GreatDs("select proids,pronames from DB_Propei where proid=" + base.Request.QueryString["typeid"] + "").Tables[0];
                    if (table.Rows.Count <= 0)
                    {
                        this.isshow = "none";
                    }
                    else
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            string pinmsg = this.pinmsg;
                            this.pinmsg = pinmsg + "<li><a href='products_category.aspx?typeid=" + base.Request.QueryString["typeid"] + "&pinid=" + row["proids"].ToString() + "'>" + row["pronames"].ToString() + "</a></li>";
                        }
                    }
                }
                else
                {
                    string sql = "select pinpaiid,pinpainame from DB_Pinpai where visible=1 order by pinpaiorder";
                    table = SQLAccess.GreatDs(sql).Tables[0];
                    if (table.Rows.Count > 0)
                    {
                        foreach (DataRow row2 in table.Rows)
                        {
                            string str3 = this.pinmsg;
                            this.pinmsg = str3 + "<li><a href='products_category.aspx?pinid=" + row2["pinpaiid"].ToString() + "'>" + row2["pinpainame"].ToString() + "</a></li>";
                        }
                    }
                    else
                    {
                        this.isshow = "none";
                    }
                }
            }
        }


    }
}